package com.share.two.bio;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintStream;
import java.io.PrintWriter;
import java.net.Socket;
import java.util.Scanner;

public class Client {

	@SuppressWarnings("resource")
	public static void main(String[] args) throws IOException {
		
		//定义socket
		Socket socket = new Socket("127.0.0.1", 55555);
		BufferedReader br = new BufferedReader(new InputStreamReader(socket.getInputStream()));
		PrintStream ps = new PrintStream(socket.getOutputStream());
		//console输入
		Scanner scanner = new Scanner(System.in);
		String line = scanner.nextLine();
		System.out.println("client发送:" + line);

		//传给客户端
		ps.println(line);

		//接收
		String back = br.readLine();
		System.out.println("client接收："+ back);

	}
}
